package com.juc.threadPoolExecutor.threadPoolExecutor15.callerRunsPolicy;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class MyThreadA_1 extends Thread{
	
	@Override
	public void run() {
		MyThreadB b = new MyThreadB();
		LinkedBlockingDeque<Runnable> queue = new LinkedBlockingDeque<>();
		ThreadPoolExecutor executor = 
				new ThreadPoolExecutor(2, 3, 5, TimeUnit.SECONDS,queue, new ThreadPoolExecutor.CallerRunsPolicy());
		System.out.println("a begin " + Thread.currentThread().getName() +  "  "+ System.currentTimeMillis());
		executor.execute(b);
		executor.execute(b);
		executor.execute(b);
		executor.execute(b);
		executor.execute(b);
		executor.execute(b);
		System.out.println("a end " + Thread.currentThread().getName() +  "  "+ System.currentTimeMillis());
		System.out.println("a end " +   "  "+ System.currentTimeMillis());
	}

}
